Part 1th Vector IntroductionVectors are vector queues, which are classes added by the JDK1.0 version. Inherits from Abstractlist, implements the list, randomaccess, cloneable these interfaces.Vector inherits the Abstractlist and realizes the list;
Conclusion: If the collection is not thread-safe, the data loss problem occurs when inserting data in multithreaded situations. Java code
Import java.util.ArrayList;
Import java.util.List;
Threads that implement the Runnable interface
ArrayList is an array-based implementation, with no capacity constraints.When you delete an element, it does not reduce the size of the array, and you can call ArrayList's trimetosize () to reduce the capacity of the
Vector usage in JAVAJava. util. Vector provides a Vector class to implement functions similar to dynamic arrays. There is no pointer concept in the Java language, but correct and flexible use of pointers can indeed greatly improve the quality of the
As in the title, if I were to answer before, I would say, yes, in the multi-threaded environment to operate the vector, do not need to add synchronized.But I accidentally saw an article today, I found that my previous idea was wrong, the address of
On the Internet, I accidentally saw an article about the Common Data Structures in Java, which has been thoroughly analyzed.
:) Linear tables, linked lists, and hash tables are common data structures. During Java Development, JDK has provided a
Differences between vector and arraylistCollectionShortlist│ Invalid parameter list│ ├ Arraylist│ Vector│ Elastic StackSorted setMap├ Hashtable├ Hashmap└ Weakhashmap
Sometimes the vector is better; sometimes the arraylist is better; sometimes
Here are some popular Java thread-related interview questions that you can use to prepare for the interview.
1 What is a thread?
A thread is the smallest unit of operation that the operating system can perform, which is included in the process and
Vector Common Methods
assign () assigning values to elements in vectors
void assign (Input_iterator start, Input_iterator end); //void assign (Size_type num, const type &VAL);
Reserve () sets the vector smallest element to hold the quantity function
Java thread surface question Top 50Original link: http://www.importnew.com/12773.html
This article is translated by Importnew-Li Guang from javarevisited. Welcome to join the Java team. Please refer to the requirements at the end of this
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.